<link rel="stylesheet" href="lib/datepicker/css/datepicker.css"/>
<div class="panel panel-default search-panel">
    <div class="panel-body">
        <form class="form-inline">
            <div class="form-group">
                <label class="sr-only" for="query_collectionId">索引名称</label>
                <select class="form-control" ng-model="query_collectionId" id="query_collectionId">
                    <option value="">选择索引</option>
                    <option ng-repeat="collection in collections" value="{{ collection.id }}">{{ collection.name }}</option>
                </select>
            </div>
            <div class="form-group">
                <label class="sr-only" for="query_errStartTime">出错开始时间</label>
                <input type="text" id="query_errStartTime" class="form-control" size="16" placeholder="出错开始时间" />
            </div>
            <div class="form-group">
                <label class="sr-only" for="query_errEndTime">出错开始时间</label>
                <input type="text" id="query_errEndTime" class="form-control" placeholder="出错开始时间" />
            </div>
            <button type="submit" class="btn btn-default" ng-click="query()">查找</button>
        </form>
    </div>
</div>

<table class="table table-striped table-bordered table-hover">
    <tr>
        <th>集合名称</th>
        <th>调用对象</th>
        <th>来源IP</th>
        <th>出错时间</th>
        <th>操作</th>
    </tr>
    <tr ng-repeat="errorlog in paged.list">
        <td>{{ collectionMap[errorlog.collectionId].name }}</td>
        <td>{{ errorlog.target}}</td>
        <td>{{ errorlog.ip}}</td>
        <td>{{ errorlog.errorTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
        <td>
            <a href="javascript:void(0)" ng-click="view(errorlog.id)" class="btn-link">查看</a>
        </td>
    </tr>
</table>

<div ng-include="'app/common/view/paged.html'"></div>

<!-- edit dialog -->
<div class="modal fade" id="viewDialog" tabindex="-1">
    <div class="modal-dialog" style="width: 1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">查看错误日志</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="editForm">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">索引</label>
                        <div class="col-sm-9">{{ collectionMap[viewErrorLog.collectionId].name }}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">IP</label>
                        <div class="col-sm-9">{{ viewErrorLog.ip }}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">目标</label>
                        <div class="col-sm-9">{{ viewErrorLog.target }}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">出错时间</label>
                        <div class="col-sm-9">{{ viewErrorLog.errorTime | date: 'yyyy-MM-dd HH:mm:ss' }}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">参数</label>
                        <div class="col-sm-9" style="overflow: auto;max-height: 200px;">{{ viewErrorLog.params }}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">Message</label>
                        <div class="col-sm-9">{{ viewErrorLog.message }}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">StackTrace</label>
                        <div class="col-sm-9" style="overflow: auto;max-height: 200px;">{{ viewErrorLog.stackTrace }}</div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
